package net.everitts.helloworldscratch.services;

import javax.inject.Inject;
import net.everitts.helloworldscratch.components.GreetingRepository;
import org.springframework.stereotype.Service;

/**
 * Simple Greeting service.
 * @author RossEveritt.
 */
@Service
public class GreetingServiceImpl implements GreetingService {

    /**
     * The greeting repository used to lookup a greeting message.
     */
    @Inject
    private GreetingRepository greetingRepository;

    /**
     * Used for mocking.
     * @param gr
     *            the greeting repository.
     */
    final void setGreetingRepository(final GreetingRepository gr) {
	greetingRepository = gr;
    }

    /**
     * Default constructor.
     */
    public GreetingServiceImpl() {
    }

    /**
     * Get a greeting message from this service.
     */
    public String getGreetingMessage() {
	return greetingRepository.getGreeting();
    }
}
